package com.service;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;









import com.dao.archiveDao;
import com.pojo.archive;
import com.pojo.log;
import com.util.MybatisSessionFactory;

public class archiveService {
	SqlSession Session = MybatisSessionFactory.getSqlSession();
	archiveDao dao3 = Session.getMapper(archiveDao.class);
	
	
	public void add(@Param("archive_id") String archive_id,
			@Param("identity") String identity,
			@Param("name") String name,
			@Param("gender") String gender,
			@Param("birthday") String birthday,
			@Param("date_retire1") String date_retire1,
			@Param("date_retire2") String date_retire2,
			@Param("sp") String sp,
			@Param("fc") String fc,
			@Param("title") String title,
			@Param("seniority") String seniority) {
              dao3.add(archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);
              Session.commit();
	}
	public Map<String, Object> lastid(
			) {
				return null;	
	}	
	public List<archive> query_c(@Param("archive_id") String archive_id,
			@Param("identity") String identity,
			@Param("name") String name,
			@Param("gender") String gender,
			@Param("birthday") String birthday,
			@Param("date_retire1") String date_retire1,
			@Param("date_retire2") String date_retire2,
			@Param("sp") String sp,
			@Param("fc") String fc,
			@Param("title") String title,
			@Param("seniority") String seniority) {
              return dao3.query_c(archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);
            
	}
	
	public archive queryone(
			@Param("id") String id
		) {
              return dao3.queryone(id);
			
	}public void querydel(
			@Param("id") String id
		) {
		dao3.querydel(id);
            Session.commit();
	}
	public void query_update(@Param("id") String id,
			@Param("archive_id") String archive_id,
			@Param("identity") String identity,
			@Param("name") String name,
			@Param("gender") String gender,
			@Param("birthday") String birthday,
			@Param("date_retire1") String date_retire1,
			@Param("date_retire2") String date_retire2,
			@Param("sp") String sp,
			@Param("fc") String fc,
			@Param("title") String title,
			@Param("seniority") String seniority) {
			 dao3.query_update(id, archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);
				  Session.commit();
				
			
	}
	public List<archive> queryall(
			@Param("archive_id") String archive_id,
			@Param("identity") String identity){
		List<archive> ren=dao3.queryall(archive_id,identity);	
	return ren;
	
	}
	public List<archive> query_one(@Param("search") String search){
		      List<archive> ren=dao3.query_one(search);	
	return ren;
	}
	
	public List<archive> query_add(@Param("id") String id,
			@Param("archive_id") String archive_id,
			@Param("identity") String identity,
			@Param("name") String name,
			@Param("gender") String gender,
			@Param("birthday") String birthday,
			@Param("date_retire1") String date_retire1,
			@Param("date_retire2") String date_retire2,
			@Param("sp") String sp,
			@Param("fc") String fc,
			@Param("title") String title,
			@Param("seniority") String seniority){
	return dao3.query_add(id, archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);
		
	}
	public List<archive> query_see(@Param("id") String id,
			@Param("archive_id") String archive_id,
			@Param("identity") String identity,
			@Param("name") String name,
			@Param("gender") String gender,
			@Param("birthday") String birthday,
			@Param("date_retire1") String date_retire1,
			@Param("date_retire2") String date_retire2,
			@Param("sp") String sp,
			@Param("fc") String fc,
			@Param("title") String title,
			@Param("seniority") String seniority){
	return dao3.query_see(id, archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);
	}
	public List<Map> query_look(
			@Param("date1") String date1,
			@Param("date2") String date2
		){
	return dao3.query_look(date1, date2);
	}
}
